package com.server.system.controller.feignController;

import com.server.common.code.utils.ResultUtil;
import com.server.model.all.system.bo.AddLogOperationBo;
import com.server.model.all.system.dto.AddLogOperationDto;
import com.server.common.code.utils.BeanUtils;
import com.server.common.code.utils.Result;
import com.server.common.security.code.SecurityUtils;
import com.server.system.service.SmsOperationLogService;
import com.server.system.service.UserOperationLogService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 用户操作日志
 * @author LXC
 * @date 2022/5/5 13:16
 */
@RestController
@RequestMapping(path = "/userOperationLog/private")
public class FeignUserOperationLogController {

    @Resource
    private UserOperationLogService userOperationLogService;

    @Resource
    private SmsOperationLogService smsOperationLogService;

    /**
     * 操作记录
     * @author LXC
     * @date 2022/6/7 20:53
     */
    @PostMapping("/addLogOperation")
    public Result<Integer> addLogOperation(@RequestBody @Validated AddLogOperationDto addLogOperationDto){
        AddLogOperationBo addLogOperationBo = BeanUtils.copyProperties(addLogOperationDto, AddLogOperationBo.class);
        addLogOperationBo.setUserId(SecurityUtils.getLoginVo().getUserId());
        return ResultUtil.successData(userOperationLogService.addLogOperation(addLogOperationBo));
    }

}
